package com.molichuxing.services.infrastructure.enums;

/**
 * 命令集合：4设为租赁、5设为非租赁、8开启动、9关闭动力
 */
public enum OperateTypeEnum {
    LEASE(4, "设为租赁"),
    NOT_LEASE(5, "设为非租赁"),
    OPEN_POWER(8, "开启动力"),
    CLOSE_POWER(9, "关闭动力"),
    ;
    int code;
    String name;

    OperateTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByCode(int code) {
        String name = null;
        for (OperateTypeEnum value : OperateTypeEnum.values()) {
            if (value.code == code) {
                name = value.getName();
                break;
            }
        }
        return name;
    }
}
